package com.lepu.app.fun.mother_circle.adapter;

import java.util.ArrayList;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.eyzhs.app.R;
import com.lepu.app.fun.my.bean.BeanPubContent;

public class AdapterMotherFunTop extends BaseAdapter {

	private LayoutInflater mLayoutInflater = null;
	@SuppressWarnings("unused")
	private Context mContext = null;
	private ArrayList<BeanPubContent> mArrayList = null;

	public AdapterMotherFunTop(Context context, ArrayList<BeanPubContent> arrayList) {
		mContext = context;
		mLayoutInflater = LayoutInflater.from(context);
		mArrayList = arrayList;
	}

	@Override
	public int getCount() {
		int size = 0;
		if (mArrayList != null && mArrayList.size() > 0) {
			size = mArrayList.size();
		}
		return size;
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@SuppressLint("InflateParams")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		final ViewHolder holder;

		if (convertView == null) {
			convertView = mLayoutInflater.inflate(R.layout.mother_fun_top_item, null);

			holder = new ViewHolder();
			
			TextView itemTextView = (TextView) convertView.findViewById(R.id.itemTextView);
			
			holder.itemTextView = itemTextView;

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		
		BeanPubContent item = mArrayList.get(position);
		
		holder.itemTextView.setText(item.TopicTitle);

		return convertView;
	}

	private static class ViewHolder {
		TextView itemTextView;
	}
}
